//
//  ViewController.m
//  AFNdemo
//
//  Created by 代辉 on 2017/9/21.
//  Copyright © 2017年 代辉. All rights reserved.
//

#import "ViewController.h"
#import <AFNetwork.h>

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    AFHTTPSessionManager *manger = [AFHTTPSessionManager manager];
    
    manger.responseSerializer.acceptableContentTypes = [manger.responseSerializer.acceptableContentTypes setByAddingObject:@"text/html"];
    [[manger GET:@"http://www.baidu.com" parameters:nil progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
        NSLog(@"%@",responseObject);
    } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {

        NSLog(@"%@",error);
//        UIAlertView *view = [[UIAlertView alloc] initWithTitle:[NSString stringWithFormat:@"%@",error] message:nil delegate:nil cancelButtonTitle:nil otherButtonTitles:nil, nil];
//        [view show];
    }] resume];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
